Method, apparatus and system for verifying code integrity on clients

ABSTRACT

A method and apparatus for verifying code integrity on a client, the method comprising: determining a verification object on the client; generating a plurality of verification sequences, wherein each verification sequence comprises a memory access mode, and a verification algorithm; randomly selecting a verification sequence from the plurality of verification sequences, and obtaining a server verification result for the verification object in accordance with the selected verification sequence; sending the selected verification sequence to the client; receiving a client verification result for the verification object calculated by the client in accordance with the selected verification sequence; and comparing the server verification result with the client verification result to obtain a code verification result.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2014/079772, entitled “Method, Apparatus and System for VerifyingCode Integrity on Clients”, filed on Jun. 12, 2014. This applicationclaims the benefit and priority of Chinese Patent Application No.201310236126.4, entitled “Method, Apparatus, and System for VerifyingCode Integrity on Clients” filed on Jun. 14, 2013. The entiredisclosures of each of the above applications are incorporated herein byreference.

TECHNICAL FIELD

The present invention relates to telecommunication technologies, andmore particularly, to method, apparatus and system for verifying codeintegrity on a client.

BACKGROUND

In client-server applications, the code executed by the client can beeasily modified by the user. In order to protect the security of theentire system, the server needs to protect the integrity of the code onthe client. To protect the integrity of the code on the client, theserver needs to detect whether the code has been modified on the client,which is done through a process called code integrity verification.

In the existing code integrity verification methods, the servertypically sends the address and size of the code that needs to beverified to the client; the client reads the data from the memory inaccordance with the received address and size of the code, calculates averification result in accordance with a verification algorithm, andsends the verification result to server; the server then compares theverification results calculated by the client and the server todetermine whether the code has been modified.

There are issues in the existing client code integrity verificationmethods. For example, the hacker can copy the original code, and modifythe verification address to the address of the copy, so that thecalculated verification result will be the same. The hacker can alsointercept the memory access function used to read data from memory, andprovide fake data to the memory access function, so that the calculatedverification result will be the same. The hacker can also provide thecorrect verification result directly to the server to circumvent thecode integrity verification.

SUMMARY OF THE INVENTION

Embodiments of the present invention provide method, apparatus andsystem for verifying code integrity on a client, which increases thedifficulty of circumventing code integrity verification and enhances theeffectiveness of code integrity verification.

In accordance with embodiments of the present invention, a method forverifying code integrity on a client is provided, the method comprising:determining a verification object on the client; generating a pluralityof verification sequences, wherein each verification sequence comprisesa memory access mode, a verification algorithm, and a packaging format;randomly selecting a verification sequence from the plurality ofverification sequences, and obtaining a server verification result forthe verification object in accordance with the selected verificationsequence; sending the selected verification sequence to the client;receiving a client verification result for the verification objectcalculated by the client in accordance with the selected verificationsequence; and comparing the server verification result with the clientverification result to obtain a code verification result.

In accordance with embodiments of the present invention, a method forverifying code integrity on a client is provided, the method comprising:receiving a verification sequence randomly selected from a plurality ofverification sequences from a server; determining a memory access modefrom X memory access modes, a verification algorithm from Y verificationalgorithms, and a packaging format from Z packaging formats inaccordance with the received verification sequence, wherein X, Y, and Zare integers larger than 1; calculating a client verification result forthe verification object in accordance with the memory access mode, theverification algorithm, and the packaging format; and sending the clientverification result to the server.

In accordance with embodiments of the present invention, a server forverifying code integrity on a client is provided, comprising: adetermining unit for determining a verification object on the client; ageneration unit for generating a plurality of verification sequences,wherein each verification sequence comprises a memory access mode, averification algorithm, and a packaging format; a processing unit forrandomly selecting a verification sequence from the plurality ofverification sequences, and obtaining a server verification result forthe verification object in accordance with the selected verificationsequence; a sending unit for sending the selected verification sequenceto the client; a receiving unit for receiving a client verificationresult for the verification object calculated by the client inaccordance with the selected verification sequence; and a verificationunit for comparing the server verification result with the clientverification result to obtain a code verification result.

In accordance with embodiments of the present invention, a client forverifying code integrity is provided, comprising: a receiving unit forreceiving a verification sequence randomly selected from a plurality ofverification sequences from a server; a determination unit fordetermining a memory access mode from X memory access modes, averification algorithm from Y verification algorithms, and a packagingformat from Z packaging formats in accordance with the receivedverification sequence, wherein X, Y, and Z are integers larger than 1; aprocessing unit for calculating a client verification result for theverification object in accordance with the memory access mode, theverification algorithm, and the packaging format; and a sending unit forsending the client verification result to the server.

In accordance with embodiments of the present invention, a plurality ofverification sequences are generated in accordance with a useridentifier, wherein each verification sequence comprises a memory accessmode, a verification algorithm, and a packaging format; a verificationsequence is randomly selected from the plurality of verificationsequences; a server verification result for the verification object iscalculated in accordance with the selected verification sequence; theselected verification sequence is sent to the client; a clientverification result for the verification object calculated by the clientin accordance with the selected verification sequence is received fromthe client; and the server verification result is compared with theclient verification result to obtain a client code verification result.As different verification sequences are generated for different useridentifiers, the verification sequence is randomly selected for thedifferent verification sequences, and each different verificationsequence includes a different memory access mode, a differentverification algorithm, and a different packaging format, the difficultyfor circumventing the code integrity verification is significantlyincreased. In addition, as each user identifier can only generate partof the verification options, even if the verification option for aparticular client is being circumvented, its effect on the whole systemis limited, and the server can simply modify the verification sequencesto continue to verify the code integrity on the circumvented clients,which significantly enhances the effectiveness of code integrityverification.

BRIEF DESCRIPTION OF THE DRAWINGS

To better illustrate the technical features of the embodiments of thepresent invention, various embodiments of the present invention will bebriefly described in conjunction with the accompanying drawings. It isobvious that the draws are but for exemplary embodiments of the presentinvention, and that a person of ordinary skill in the art may deriveadditional draws without deviating from the principles of the presentinvention.

FIG. 1a is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention.

FIG. 1b is an exemplary schematic diagram illustrating verificationaddresses in accordance with an embodiment of the present invention.

FIG. 2 is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention.

FIG. 3 is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with yet another embodiment of thepresent invention.

FIG. 4 is an exemplary schematic diagram for a server for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention.

FIG. 5 is an exemplary schematic diagram for a client for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention.

FIG. 6 is an exemplary schematic diagram for a client for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention.

FIG. 7 is an exemplary schematic diagram for a server for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

To better illustrate the purpose, technical feature, and advantages ofthe embodiments of the present invention, various embodiments of thepresent invention will be further described in conjunction with theaccompanying drawings.

The embodiments of the present invention provide method, apparatus andsystem for verifying code integrity on a client, and will be describedseparately below.

This embodiment will be described from the perspective of a server.

A method for verifying code integrity on a client, the methodcomprising: determining a verification object on the client, andobtaining a user identifier of the client; generating a plurality ofverification sequences in accordance with the user identifier, whereineach verification sequence comprises a memory access mode, averification algorithm, and a packaging format; randomly selecting averification sequence from the plurality of verification sequences, andcalculating a server verification result for the verification object inaccordance with the selected verification sequence; sending the selectedverification sequence to the client; receiving a client verificationresult for the verification object calculated by the client inaccordance with the selected verification sequence; and comparing theserver verification result with the client verification result to obtaina client code verification result: if the server verification result isconsistent with the client verification result, the client codeverification result is positive; otherwise, the client code verificationresult is negative.

FIG. 1a is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention. As shown in FIG. 1a , the method includes the followingsteps.

Step 101: determining a verification object on the client, and obtaininga user identifier of the client.

Here, the verification object is the code on the client that needs to bechecked for its integrity, such as software executable files, sourcecode, scripts, and configuration files.

Step 102: generating a plurality of verification sequences in accordancewith the user identifier obtained in Step 101, wherein each verificationsequence comprises a memory access mode, a verification algorithm, and apackaging format.

The client pre-stores X memory access modes, Y verification algorithms,and Z packaging formats, wherein X, Y, and Z are integers larger than 1.The specific values for X, Y, and Z can be set based on systemrequirement. In another words, in verifying code integrity in accordancewith embodiments of the present invention, there are a total of X*Y*Zverification options, and each verification sequence corresponds to averification option having a specific memory access mode, a specificverification algorithm, and a specific packaging format.

There are a variety of memory access modes, verification algorithms, andpackaging formats.

(1) Memory Access Modes

A memory access mode includes the determination of a verificationaddress and a verification size for the verification object, and amemory access function.

The verification address needs to overlap with the actual address of theverification object. For example, if the address of the verificationobject is (X, Y), then the verification address can be (X−a, Y+b), where0<a<X, and 0<b<MaxAdd−Y.

If the address of the verification object is (X, Y), data stored inmemory at (X, Y) needs to be checked. For one user, a can be 0 and b canbe a positive value b1, so the address on the client that will bechecked will be (X, Y+b1). For another user, a can be a positive valuea1, and b can be 0, so that the address on the client that will bechecked will be (X−a, Y). For yet another user, a can be a positivevalue a1 and b can be a positive value b1, so that the address on theclient that will be checked will be (X−a1, Y+b1). FIG. 1b is anexemplary schematic diagram illustrating verification addresses inaccordance with an embodiment of the present invention. As shown in FIG.1b , the verification address can be chosen differently, as far as itoverlaps with the actual address of the verification object.

Similarly, there are many different memory access functions can be usedto read data from memory, such as memmove( ), memcpy( ),ReadProcessMemory( ) or ZwReadVirtualMemory( ). In addition, based onthe need, new memory access functions can be written to read data frommemory, such as reading one character a time in order, reading onecharacter a time in reverse order, reading two characters a time inorder, reading two characters a time in reverse order, reading fourcharacters a time in order, reading four characters a time in reverseorder, or reading every other character. Furthermore, drivers can bewritten to call core functions to read data from memory reserved for aparticular process.

It should be noted that, one memory access function can be used to readdata from the memory, or a number of memory access functions can be usedto read data from different part of the memory, and the different memoryaccess functions and the combination thereof can be used for differentmemory access mode.

(2) Verification Algorithm

The data from memory can be calculated in accordance with theverification algorithm to obtain a calculation result. The verificationalgorithm needs to ensure the consistency of the calculation result,i.e., the same data will derive the same calculation result.

For example, the verification algorithm can be any of the following:CRC32, CRC16, MD5, SHA160, SHA256, SHA384, SHA512, HAVAL128, HAVAL160,HAVAL192, HAVAL224, HAVAL256, RIPEMD160.

In addition, the verification algorithm can also process data in thememory according to the need, such as: NOR four characters by fourcharacters; ADD character by character; ADD characters in odd positions;NOR or ADD characters in even positions with characters in oddpositions.

(3) Packaging Format

Since the server may send multiple verification sequences for multipleverification objects, the client need to send such information back tothe server along with the client verification result so that the serverwill compare that with the appropriate server verification result. Thedata package that the client sends to the server needs to include atleast the following data items: the verification address, theverification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format.

Here, the packaging format can be the order of data items in the datapackage. In another words, the packaging format can be any combinationof these six parameters, such as “the verification address, theverification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format”, “theverification size, the verification address, the client verificationresult, the memory access mode, the verification algorithm, and thepackaging format”, or “the client verification result, the verificationsize, the verification address, the memory access mode, the verificationalgorithm, and the packaging format.”

Optionally, a number of superfluous data items can be added to the datapackage to further complicate the combination. In another word, the datapackage can further include n superfluous data items having no apparentmeanings, where n is an integer; and the packaging format can be anycombination of (6+n) parameters.

Step 103: randomly selecting a verification sequence from the pluralityof verification sequences, and calculating a server verification resultfor the verification object in accordance with the selected verificationsequence.

Here, a random number can be generated from the user identifier of theclient, an Media Access Control (MAC) address of the user, an InternetProtocol (IP) address of the user, a registration time of the user, or alogin time of the user, and the step of randomly selecting averification sequence from the plurality of verification sequences caninclude generating a random number from the user identifier of theclient, an MAC address of the user, an IP address of the user, aregistration time of the user, or a login time of the user; and randomlyselecting a verification sequence from the plurality of verificationsequences in accordance with the random number.

Here, the step of calculating a server verification result for theverification object in accordance with the selected verificationsequence can including the following steps: (1) determining a memoryaccess mode, a verification algorithm, and a packaging format inaccordance with the selected verification sequence; (2) reading data forthe verification object from memory in accordance with the memory accessmode; (3) calculating a server verification value using the data inaccordance with the verification algorithm; and (4) packaging the serververification value in accordance with the packaging format to obtain theserver verification result. The step of reading data for theverification object from memory in accordance with the memory accessmode further includes: determining a verification address and averification size for the verification object in accordance with thememory access mode, wherein the verification address overlaps with theaddress of the verification object (see Step 102 for more detaileddescription); determining a memory access function from a preset list ofmemory access functions in accordance with the memory access mode; andreading data for the verification object from memory in accordance withthe verification address, the verification size, and the memory accessfunction.

Alternatively, the server verification result can be obtained from averification result database in accordance with the selectedverification sequence. The data in the verification result database maybe obtained from a server or a verified client.

Step 104: sending the selected verification sequence to the client.

Here, Step 104 can be performed either before or after the step ofcalculating a server verification result for the verification object inaccordance with the selected verification sequence in Step 103.

Step 105: receiving a client verification result for the verificationobject calculated by the client in accordance with the selectedverification sequence.

The client can obtain the client verification results in the followingsteps:

(1) determining a memory access mode from X memory access modespre-stored on the client, a verification algorithm from Y verificationalgorithms pre-stored on the client, and a packaging format from Zpackaging formats pre-stored on the client in accordance with thereceived verification sequence, wherein X, Y, and Z are integers largerthan 1.

(2) calculating a client verification result for the verification objectin accordance with the memory access mode, the verification algorithm,and the packaging format, such as reading data for the verificationobject from memory in accordance with the memory access mode;calculating a client verification value using the data in accordancewith the verification algorithm; packaging the client verification valuein accordance with the packaging format to obtain the clientverification result.

Here, the step of reading data for the verification object from memoryin accordance with the memory access mode can include: determining averification address and a verification size for the verification objectin accordance with the memory access mode, wherein the verificationaddress overlaps with the address of the verification object;determining a memory access function from a preset list of memory accessfunctions in accordance with the memory access mode; and reading datafor the verification object from memory in accordance with theverification address, the verification size, and the memory accessfunction.

Step 106: comparing the server verification result obtained in Step 104with the client verification result obtained in Step 105 to obtain aclient code verification result: if the server verification result isconsistent with the client verification result, the client codeverification result is positive; otherwise, the client code verificationresult is negative.

In this embodiment, a plurality of verification sequences are generatedin accordance with a user identifier, wherein each verification sequencecomprises a memory access mode, a verification algorithm, and apackaging format; a verification sequence is randomly selected from theplurality of verification sequences; a server verification result forthe verification object is calculated in accordance with the selectedverification sequence; the selected verification sequence is sent to theclient; a client verification result for the verification objectcalculated by the client in accordance with the selected verificationsequence is received from the client; and the server verification resultis compared with the client verification result to obtain a client codeverification result. As different verification sequences are generatedfor different user identifiers, the verification sequence is randomlyselected for the different verification sequences, and each differentverification sequence includes a different memory access mode, adifferent verification algorithm, and a different packaging format, thedifficulty for circumventing the code integrity verification issignificantly increased. In addition, as each user identifier can onlygenerate part of the verification options, even if the verificationoption for a particular client is being circumvented, its effect on thewhole system is limited, and the server can simply modify theverification sequences to continue to verify the code integrity on thecircumvented clients, which significantly enhances the effectiveness ofcode integrity verification.

This embodiment will be described from the perspective of a client. Inthe following discussion, the term “client” may refer to, a clientterminal device, which includes but is not limited to, a desktopcomputer, a laptop, a netbook, a tablet, a mobile phone, a multimedia TVand other electronic equipment, or a client side application program.

A method for verifying code integrity on a client, the methodcomprising: receiving a verification sequence randomly selected from aplurality of verification sequences from a server, where the pluralityof verification sequences are generated in accordance with a useridentifier of a client, and each verification sequence comprises amemory access mode, a verification algorithm, and a packaging format;determining a memory access mode from X memory access modes pre-storedon the client, a verification algorithm from Y verification algorithmspre-stored on the client, and a packaging format from Z packagingformats pre-stored on the client in accordance with the receivedverification sequence, wherein X, Y, and Z are integers larger than 1;calculating a client verification result for the verification object inaccordance with the memory access mode, the verification algorithm, andthe packaging format; and sending the client verification result to theserver for comparison with a server verification result for theverification object to obtain a code verification result, wherein theserver verification result is calculated in accordance with the selectedverification sequence.

FIG. 2 is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention. As shown in FIG. 2, the method includes the followingsteps.

Step 201: receiving a verification sequence randomly selected from aplurality of verification sequences from a server.

Here, the plurality of verification sequences are generated inaccordance with a user identifier of a client, and each verificationsequence comprises a memory access mode, a verification algorithm, and apackaging format.

There are a variety of memory access modes, verification algorithms, andpackaging formats.

(1) Memory Access Modes

A memory access mode includes the determination of a verificationaddress and a verification size for the verification object, and amemory access function.

The verification address needs to overlap with the actual address of theverification object. For example, if the address of the verificationobject is (X, Y), then the verification address can be (X−a, Y+b), where0<a<X, and 0<b<MaxAdd−Y.

Similarly, there are many different memory access functions can be usedto read data from memory, such as memmove( ), memcpy( ),ReadProcessMemory( ) or ZwReadVirtualMemory( ). In addition, based onthe need, new memory access functions can be written to read data frommemory, such as reading one character a time in order, reading onecharacter a time in reverse order, reading two characters a time inorder, reading two characters a time in reverse order, reading fourcharacters a time in order, reading four characters a time in reverseorder, or reading every other character. Furthermore, drivers can bewritten to call core functions to read data from memory reserved for aparticular process.

It should be noted that, one memory access function can be used to readdata from the memory, or a number of memory access functions can be usedto read data from different part of the memory, and the different memoryaccess functions and the combination thereof can be used for differentmemory access mode.

(2) Verification Algorithm

The data from memory can be calculated in accordance with theverification algorithm to obtain a calculation result. The verificationalgorithm needs to ensure the consistency of the calculation result,i.e., the same data will derive the same calculation result.

For example, the verification algorithm can be any of the following:CRC32, CRC16, MD5, SHA160, SHA256, SHA384, SHA512, HAVAL128, HAVAL160,HAVAL192, HAVAL224, HAVAL256, RIPEMD160.

In addition, the verification algorithm can also process data in thememory according to the need, such as: NOR four characters by fourcharacters; ADD character by character; ADD characters in odd positions;NOR or ADD characters in even positions with characters in oddpositions.

(3) Packaging Format

Since the server may send multiple verification sequences for multipleverification objects, the client need to send such information back tothe server along with the client verification result so that the serverwill compare that with the appropriate server verification result. Thedata package that the client sends to the server needs to include atleast the following data items: the verification address, theverification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format.

Here, the packaging format can be the order of data items in the datapackage. In another words, the packaging format can be any combinationof these six parameters, such as “the verification address, theverification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format”, “theverification size, the verification address, the client verificationresult, the memory access mode, the verification algorithm, and thepackaging format”, or “the client verification result, the verificationsize, the verification address, the memory access mode, the verificationalgorithm, and the packaging format.”

Optionally, a number of superfluous data items can be added to the datapackage to further complicate the combination. In another word, the datapackage can further include n superfluous data items having no apparentmeanings, where n is an integer; and the packaging format can be anycombination of (6+n) parameters.

Step 202: determining a memory access mode from X memory access modespre-stored on the client, a verification algorithm from Y verificationalgorithms pre-stored on the client, and a packaging format from Zpackaging formats pre-stored on the client in accordance with thereceived verification sequence.

Here, X, Y, and Z are integers larger than 1, and can be set based onneed.

Step 203: calculating a client verification result for the verificationobject in accordance with the memory access mode, the verificationalgorithm, and the packaging format.

Here, Step 203 can include reading data for the verification object frommemory in accordance with the memory access mode; calculating a clientverification value using the data in accordance with the verificationalgorithm; packaging the client verification value in accordance withthe packaging format to obtain the client verification result.

Here, the step of reading data for the verification object from memoryin accordance with the memory access mode can include: determining averification address and a verification size for the verification objectin accordance with the memory access mode, wherein the verificationaddress overlaps with the address of the verification object;determining a memory access function from a preset list of memory accessfunctions in accordance with the memory access mode; and reading datafor the verification object from memory in accordance with theverification address, the verification size, and the memory accessfunction.

Step 204: sending the client verification result to the server forcomparison with a server verification result for the verification objectto obtain a code verification result, wherein the server verificationresult is calculated in accordance with the selected verificationsequence.

Here, the server verification result is calculated by the server inaccordance with the selected verification sequence, or obtained from averification result database. The embodiment above can be referenced forthe implementation details of Step 204, which will not be repeated here.

In this embodiment, a verification sequence randomly selected from aplurality of verification sequences is received from a server, where theplurality of verification sequences are generated in accordance with auser identifier of a client, and each verification sequence comprises amemory access mode, a verification algorithm, and a packaging format; aclient verification result for the verification object is calculated inaccordance with the verification sequence, and sent to the server forcomparison with a server verification result for the verification objectto obtain a code verification result, wherein the server verificationresult is calculated in accordance with the selected verificationsequence. As different verification sequences are generated fordifferent user identifiers, the verification sequence is randomlyselected for the different verification sequences, and each differentverification sequence includes a different memory access mode, adifferent verification algorithm, and a different packaging format, thedifficulty for circumventing the code integrity verification issignificantly increased. In addition, as each user identifier can onlygenerate part of the verification options, even if the verificationoption for a particular client is being circumvented, its effect on thewhole system is limited, and the server can simply modify theverification sequences to continue to verify the code integrity on thecircumvented clients, which significantly enhances the effectiveness ofcode integrity verification.

The above embodiments will be further descripted in connection with thefollowing example.

FIG. 3 is an exemplary flowchart for a method for verifying codeintegrity on a client in accordance with yet another embodiment of thepresent invention. As shown in FIG. 3, the method includes the followingsteps.

Step 301: the server determining a verification object on the client,and obtaining a user identifier of a client.

Here, the verification object is the code on the client that needs to bechecked for its integrity.

Step 302: the server generating a plurality of verification sequences inaccordance with the user identifier obtained in Step 301, wherein eachverification sequence comprises a memory access mode, a verificationalgorithm, and a packaging format.

The client pre-stores X memory access modes, Y verification algorithms,and Z packaging formats, wherein X, Y, and Z are integers larger than 1.The specific values for X, Y, and Z can be set based on systemrequirement. In another words, in verifying code integrity in accordancewith embodiments of the present invention, there are a total of X*Y*Zverification options, and each verification sequence corresponds to averification option having a specific memory access mode, a specificverification algorithm, and a specific packaging format. For example,Table 1 below list the X memory access modes, Y verification algorithms,and Z packaging formats pre-stored on the client; while Table 2illustrates the relationship between the verification sequences and theX memory access modes, Y verification algorithms, and Z packagingformats.

TABLE 1 Memory Access Mode 1 Verification Algorithm 1 Packaging Format 1Memory Access Mode 2 Verification Algorithm 2 Packaging Format 2 MemoryAccess Mode 3 Verification Algorithm 3 Packaging Format 3 . . . . . . .. . Memory Access Mode X Verification Algorithm Y Packaging Format Z

TABLE 2 Verification Memory Access Mode Verification Packaging FormatSequence 1 X₁ Algorithm Y₁ Z₁ Verification Memory Access ModeVerification Packaging Format Sequence 2 X₂ Algorithm Y₂ Z₂ VerificationMemory Access Mode Verification Packaging Format Sequence 3 X₃ AlgorithmY₃ Z₃ . . . . . . . . . . . . Verification Memory Access ModeVerification Packaging Format Sequence K X_(K) Algorithm Y_(K) Z_(K)

There are a variety of memory access modes, verification algorithms, andpackaging formats.

Step 303: the server randomly selecting a verification sequence from theplurality of verification sequences.

Here, a random number can be generated from the user identifier of theclient, an Media Access Control (MAC) address of the user, an InternetProtocol (IP) address of the user, a registration time of the user, or alogin time of the user; and a verification sequence can be randomlyselected from the plurality of verification sequences in accordance withthe random number.

Step 304: the server calculating a server verification result for theverification object in accordance with the selected verificationsequence in Step 303.

Here, Step 304 can including the following steps: (1) determining amemory access mode, a verification algorithm, and a packaging format inaccordance with the selected verification sequence; (2) reading data forthe verification object from memory in accordance with the memory accessmode; (3) calculating a server verification value using the data inaccordance with the verification algorithm; and (4) packaging the serververification value in accordance with the packaging format to obtain theserver verification result. The step of reading data for theverification object from memory in accordance with the memory accessmode further includes: determining a verification address and averification size for the verification object in accordance with thememory access mode, wherein the verification address overlaps with theaddress of the verification object (see Step 102 for more detaileddescription); determining a memory access function from a preset list ofmemory access functions in accordance with the memory access mode; andreading data for the verification object from memory in accordance withthe verification address, the verification size, and the memory accessfunction.

Alternatively, the server verification result can be obtained from averification result database in accordance with the selectedverification sequence. The data in the verification result database maybe obtained from a server or a verified client.

Step 305: the server sending the selected verification sequence in step304 to the client.

Here, Steps 305 can be performed either before or after Step 304.

Step 306: the client determining a memory access mode from X memoryaccess modes pre-stored on the client, a verification algorithm from Yverification algorithms pre-stored on the client, and a packaging formatfrom Z packaging formats pre-stored on the client in accordance with thereceived verification sequence, wherein X, Y, and Z are integers largerthan 1.

Step 307: the client calculating a client verification result for theverification object in accordance with the memory access mode, theverification algorithm, and the packaging format.

Here, Step 307 can include reading data for the verification object frommemory in accordance with the memory access mode; calculating a clientverification value using the data in accordance with the verificationalgorithm; packaging the client verification value in accordance withthe packaging format to obtain the client verification result.

Here, the step of reading data for the verification object from memoryin accordance with the memory access mode can include: determining averification address and a verification size for the verification objectin accordance with the memory access mode, wherein the verificationaddress overlaps with the address of the verification object;determining a memory access function from a preset list of memory accessfunctions in accordance with the memory access mode; and reading datafor the verification object from memory in accordance with theverification address, the verification size, and the memory accessfunction.

Step 308: the client sending the client verification result obtained inStep 307 to the server.

Step 309: after receiving the client verification result, the servercomparing the server verification result obtained in Step 304 with theclient verification result to obtain a client code verification result:if the server verification result is consistent with the clientverification result, the client code verification result is positive;otherwise, the client code verification result is negative.

Here, the packaging format can be used to match the client verificationresult with the appropriate server verification result.

In this embodiment, a plurality of verification sequences are generatedin accordance with a user identifier, wherein each verification sequencecomprises a memory access mode, a verification algorithm, and apackaging format; a verification sequence is randomly selected from theplurality of verification sequences; a server verification result forthe verification object is calculated in accordance with the selectedverification sequence; the selected verification sequence is sent to theclient; a client verification result for the verification objectcalculated by the client in accordance with the selected verificationsequence is received from the client; and the server verification resultis compared with the client verification result to obtain a client codeverification result. As different verification sequences are generatedfor different user identifiers, the verification sequence is randomlyselected for the different verification sequences, and each differentverification sequence includes a different memory access mode, adifferent verification algorithm, and a different packaging format, thedifficulty for circumventing the code integrity verification issignificantly increased. In addition, as each user identifier can onlygenerate part of the verification options, even if the verificationoption for a particular client is being circumvented, its effect on thewhole system is limited, and the server can simply modify theverification sequences to continue to verify the code integrity on thecircumvented clients, which significantly enhances the effectiveness ofcode integrity verification.

FIG. 4 is an exemplary schematic diagram for a server for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention. As shown in FIG. 4, the server includes a determination unit401, a generation unit 402, a processing unit 403, a sending unit 404, areceiving unit 405 and a verification unit 406.

The determination unit 401 is used for determining a verification objecton the client, and obtaining a user identifier of a client.

The generation unit 402 is used for generating a plurality ofverification sequences in accordance with the user identifier, whereineach verification sequence comprises a memory access mode, averification algorithm, and a packaging format.

The client pre-stores X memory access modes, Y verification algorithms,and Z packaging formats, wherein X, Y, and Z are integers larger than 1.The specific values for X, Y, and Z can be set based on systemrequirement. In another words, in verifying code integrity in accordancewith embodiments of the present invention, there are a total of X*Y*Zverification options, and each verification sequence corresponds to averification option having a specific memory access mode, a specificverification algorithm, and a specific packaging format.

There are a variety of memory access modes, verification algorithms, andpackaging formats.

The processing unit 403 is used for randomly selecting a verificationsequence from the plurality of verification sequences, and calculating aserver verification result for the verification object in accordancewith the selected verification sequence.

The sending unit 404 is used for sending the selected verificationsequence to the client.

The receiving unit 405 is used for receiving a client verificationresult for the verification object calculated in accordance with theselected verification sequence by the client.

The verification unit 406 is used for comparing the server verificationresult with the client verification result to obtain a client codeverification result: if the server verification result is consistentwith the client verification result, the client code verification resultis positive; otherwise, the client code verification result is negative.

The processing unit 403 can include a selection subunit, a determinationsubunit, a reading subunit, a calculating subunit and a packagingsubunit.

The selection subunit is used for randomly selecting a verificationsequence from the plurality of verification sequences.

The determination subunit is used for determining a memory access mode,a verification algorithm, and a packaging format in accordance with theselected verification sequence.

The reading subunit is used for reading data for the verification objectfrom memory in accordance with the memory access mode.

The calculating subunit is used for calculating a server verificationvalue using the data in accordance with the verification algorithm.

The packaging subunit is used for packaging the server verificationvalue in accordance with the packaging format to obtain the serververification result.

The reading subunit is further used for determining a verificationaddress and a verification size for the verification object inaccordance with the memory access mode, wherein the verification addressoverlaps with the address of the verification object (see Step 102 formore detailed description); determining a memory access function from apreset list of memory access functions in accordance with the memoryaccess mode; and reading data for the verification object from memory inaccordance with the verification address, the verification size, and thememory access function.

Here, a random number can be generated from the user identifier of theclient, an Media Access Control (MAC) address of the user, an InternetProtocol (IP) address of the user, a registration time of the user, or alogin time of the user and the processing unit 403 is further used forgenerating a random number from the user identifier, an MAC address ofthe user, an IP address of the user, a registration time of the user, ora login time of the user; and randomly selecting a verification sequencefrom the plurality of verification sequences in accordance with therandom number.

The various units and subunits can be implemented as separate entities,or be combined as one or more entities, and the descriptions in theprevious embodiments can be referenced for their implementation details.

In this embodiment, a plurality of verification sequences are generatedby the generation unit 402 in accordance with a user identifier, whereineach verification sequence comprises a memory access mode, averification algorithm, and a packaging format; a verification sequenceis randomly selected from the plurality of verification sequences by theprocessing unit 403; a server verification result for the verificationobject is calculated in accordance with the selected verificationsequence; the selected verification sequence is sent to the client bythe sending unit 404; a client verification result for the verificationobject calculated by the client in accordance with the selectedverification sequence is received from the client by the receiving unit405; and the server verification result is compared with the clientverification result to obtain a client code verification result by theverification unit 406. As different verification sequences are generatedfor different user identifiers, the verification sequence is randomlyselected for the different verification sequences, and each differentverification sequence includes a different memory access mode, adifferent verification algorithm, and a different packaging format, thedifficulty for circumventing the code integrity verification issignificantly increased. In addition, as each user identifier can onlygenerate part of the verification options, even if the verificationoption for a particular client is being circumvented, its effect on thewhole system is limited, and the server can simply modify theverification sequences to continue to verify the code integrity on thecircumvented clients, which significantly enhances the effectiveness ofcode integrity verification.

FIG. 5 is an exemplary schematic diagram for a client for verifying codeintegrity on a client in accordance with an embodiment of the presentinvention. As shown in FIG. 5, the client includes a receiving unit 501,a determination unit 502, a processing unit 503, and a sending unit 504.

The receiving unit 501 is used for receiving a verification sequencerandomly selected from a plurality of verification sequences from aserver.

Here, the plurality of verification sequences are generated inaccordance with a user identifier of a client, and each verificationsequence comprises a memory access mode, a verification algorithm, and apackaging format.

There are a variety of memory access modes, verification algorithms, andpackaging formats.

The determination unit 502 is used for determining a memory access modefrom X memory access modes pre-stored on the client, a verificationalgorithm from Y verification algorithms pre-stored on the client, and apackaging format from Z packaging formats pre-stored on the client inaccordance with the received verification sequence.

Here, X, Y, and Z are integers larger than 1, and can be set based onneeds.

The processing unit 503 is used for calculating a client verificationresult for the verification object in accordance with the memory accessmode, the verification algorithm, and the packaging format.

The sending unit 504 is used for sending the client verification resultto the server for comparison with a server verification result for theverification object to obtain a code verification result.

Here, the server verification result is calculated in accordance withthe selected verification sequence.

The processing unit 503 can include a reading subunit, a calculatingsubunit, and a packaging subunit.

The reading subunit can be used for reading data for the verificationobject from memory in accordance with the memory access mode.

The calculating subunit can be used for calculating a clientverification value using the data in accordance with the verificationalgorithm.

The packaging subunit can be used for packaging the client verificationvalue in accordance with the packaging format to obtain the clientverification result.

Here, the reading subunit can be used for determining a verificationaddress and a verification size for the verification object inaccordance with the memory access mode, wherein the verification addressoverlaps with the address of the verification object; determining amemory access function from a preset list of memory access functions inaccordance with the memory access mode; and reading data for theverification object from memory in accordance with the verificationaddress, the verification size, and the memory access function.

The various units and subunits can be implemented as separate entities,or be combined as one or more entities, and the descriptions in theprevious embodiments can be referenced for their implementation details.

In this embodiment, a verification sequence randomly selected from aplurality of verification sequences is received from a server by thereceiving unit 501, where the plurality of verification sequences aregenerated in accordance with a user identifier of a client, and eachverification sequence comprises a memory access mode, a verificationalgorithm, and a packaging format; a client verification result for theverification object is calculated by the determination unit 502 and theprocessing unit 503 in accordance with the verification sequence, andsent to the server by the sending unit 504 for comparison with a serververification result for the verification object to obtain a codeverification result, wherein the server verification result iscalculated in accordance with the selected verification sequence. Asdifferent verification sequences are generated for different useridentifiers, the verification sequence is randomly selected for thedifferent verification sequences, and each different verificationsequence includes a different memory access mode, a differentverification algorithm, and a different packaging format, the difficultyfor circumventing the code integrity verification is significantlyincreased. In addition, as each user identifier can only generate partof the verification options, even if the verification option for aparticular client is being circumvented, its effect on the whole systemis limited, and the server can simply modify the verification sequencesto continue to verify the code integrity on the circumvented clients,which significantly enhances the effectiveness of code integrityverification.

In another embodiment, a telecommunication system is provided, whichincludes a server and a client in accordance with the above embodiments.

FIG. 6 is an exemplary schematic diagram for a client for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention. As shown in FIG. 6, the client includes an RF circuit601, one or more computer-readable storage medium or storage unit 602,an input unit 603, a display unit 604, a sensor 605, an audio circuit606, a WiFi module 607, a processor 608, and a power supply 609. Thoseskilled in the art will understand that the client could include more orless components that those illustrated in FIG. 6.

The RF circuit 601 can be used to send and receive signals to theprocessor 280 or a base station during data transmission and/or audiocommunication.

The storage unit 602 can be used to store software programs and modules,which can be executed by the processor 608 to perform a variety offunctions and data processing.

The input unit 603 can be used to receive the input of numeric orcharacter information, or to receive signal from system input or controldevices such as keyboard, mouse, joystick, or optical trackball.

The display unit 604 can be used to display information entered by auser or provided to the users on a graphical user interface, which caninclude graphs, texts, icons, videos, and the combination thereof.

The client may also include at least one sensor 605, such as a lightsensor, a motion sensor or other sensors.

The audio circuit 606 provides the client with an audio interface, andcan be used to process audio data.

The WiFi module 607 can be used to establish a WiFi connection for theclient, which is a wireless connection for providing Internet accessover a short distance.

The processor 608 is the control center of the client. The processor 608is connected to the various components of the electronic devices throughvarious interface and wires, and executes the software programs andmodules stored in storage unit 602 to perform a variety of functions anddata processing.

The client also includes a power source 609, such as a battery.

Specifically, the storage unit 602 stores software programs and modulesthat correspond to the client for verifying code integrity in accordancewith the embodiments of the present invention, and the processor 608executes the software programs and modules to perform the methods forverifying code integrity in accordance with the embodiments of thepresent invention.

FIG. 7 is an exemplary schematic diagram for a server for verifying codeintegrity on a client in accordance with another embodiment of thepresent invention. As shown in FIG. 6, the server includes an RF circuit701, one or more computer-readable storage medium or storage unit 702,an input unit 703, a display unit 704, a processor 705, and a powersupply 706. Those skilled in the art will understand that the clientcould include more or less components that those illustrated in FIG. 7.

The RF circuit 701 can be used to send and receive signals to theprocessor 705 or a base station during data transmission and/or audiocommunication.

The storage unit 702 can be used to store software programs and modules,which can be executed by the processor 705 to perform a variety offunctions and data processing.

The input unit 703 can be used to receive the input of numeric orcharacter information, or to receive signal from system input or controldevices such as keyboard, mouse, joystick, or optical trackball.

The display unit 704 can be used to display information entered by auser or provided to the users on a graphical user interface, which caninclude graphs, texts, icons, videos, and the combination thereof.

The processor 705 is the control center of the server. The processor 608is connected to the various components of the electronic devices throughvarious interface and wires, and executes the software programs andmodules stored in storage unit 702 to perform a variety of functions anddata processing.

The server also includes a power source 706, such as a battery.

Specifically, the storage unit 702 stores software programs and modulesthat correspond to the server for verifying code integrity in accordancewith the embodiments of the present invention, and the processor 705executes the software programs and modules to perform the methods forverifying code integrity in accordance with the embodiments of thepresent invention.

The various modules, units, and components described above can beimplemented as an Application Specific Integrated Circuit (ASIC); anelectronic circuit; a combinational logic circuit; a field programmablegate array (FPGA); a processor (shared, dedicated, or group) thatexecutes code; or other suitable hardware components that provide thedescribed functionality. The processor can be a microprocessor providedby from Intel, or a mainframe computer provided by IBM.

Note that one or more of the functions described above can be performedby software or firmware stored in memory and executed by a processor, orstored in program storage and executed by a processor. The software orfirmware can also be stored and/or transported within anycomputer-readable medium for use by or in connection with an instructionexecution system, apparatus, or device, such as a computer-based system,processor-containing system, or other system that can fetch theinstructions from the instruction execution system, apparatus, or deviceand execute the instructions. In the context of this document, a“computer-readable medium” can be any medium that can contain or storethe program for use by or in connection with the instruction executionsystem, apparatus, or device. The computer readable medium can include,but is not limited to, an electronic, magnetic, optical,electromagnetic, infrared, or semiconductor system, apparatus or device,a portable computer diskette (magnetic), a random access memory (RAM)(magnetic), a read-only memory (ROM) (magnetic), an erasableprogrammable read-only memory (EPROM) (magnetic), a portable opticaldisc such a CD, CD-R, CD-RW, DVD, DVD-R, or DVD-RW, or flash memory suchas compact flash cards, secured digital cards, USB memory devices,memory sticks, and the like.

The various embodiments of the present invention are merely preferredembodiments, and are not intended to limit the scope of the presentinvention, which includes any modification, equivalent, or improvementthat does not depart from the spirit and principles of the presentinvention.

1-7. (canceled)
 8. A method for verifying code integrity on a client,the method comprising: receiving a verification sequence randomlyselected from a plurality of verification sequences from a server;determining a memory access mode from X memory access modes, averification algorithm from Y verification algorithms, and a packagingformat from Z packaging formats based on the received verificationsequence, wherein X, Y, and Z are integers larger than 1; determining averification address and a verification size for a verification objectbased on the memory access mode of the selected verification sequence,wherein the verification address overlaps with an address of theverification object; determining a memory access function from a presetlist of memory access functions based on the memory access mode of theselected verification sequence; reading data for the verification objectfrom memory based on the verification address, the verification size,and the memory access function; calculating a client verification valueusing the data based on the verification algorithm of the selectedverification sequence; packaging the client verification value based onthe packaging format of the selected verification sequence to obtain aclient verification result; and sending the client verification resultto the server. 9.-10. (canceled)
 11. The method of claim 8, wherein thepackaging format comprises an order of a plurality of data items,wherein the plurality of data items comprise the verification address,the verification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format.
 12. Themethod of claim 11, wherein the plurality of data items comprise asuperfluous data item. 13.-17. (canceled)
 18. A client for verifyingcode integrity, comprising: a memory; and a processor coupled to memoryand configured to perform: receiving a verification sequence randomlyselected from a plurality of verification sequences from a server;determining a memory access mode from X memory access modes, averification algorithm from Y verification algorithms, and a packagingformat from Z packaging formats based on the received verificationsequence, wherein X, Y, and Z are integers larger than 1; determining averification address and a verification size for a verification objectbased on the memory access mode of the selected verification sequence,wherein the verification address overlaps with an address of theverification object; determining a memory access function from a presetlist of memory access functions based on the memory access mode of theselected verification sequence; reading data for the verification objectfrom memory based on the verification address, the verification size,and the memory access function; calculating a client verification valueusing the data based on the verification algorithm of the selectedverification sequence; packaging the client verification value based onthe packaging format of the selected verification sequence to obtain aclient verification result; and sending the client verification resultto the server. 19.-20. (canceled)
 21. The client of claim 18, whereinthe packaging format comprises an order of a plurality of data items,wherein the plurality of data items comprise the verification address,the verification size, the client verification result, the memory accessmode, the verification algorithm, and the packaging format.
 22. Theclient of claim 21, wherein the plurality of data items comprise asuperfluous data item.
 23. The client of claim 18, wherein the processoris further configured to perform: after sending the client verificationresult, receiving a code verification result from the server, the codeverification result being obtained by comparing the client verificationresult with a server verification result generated by the server basedon the selected verification sequence.
 24. The client of claim 18,wherein the processor is further configured to perform: sending a useridentifier of the client to the server, wherein the verificationsequence is randomly selected by the server based on the useridentifier.
 25. The client of claim 18, wherein the verificationsequence is randomly selected by the server based on a random number,and the random number is generated from one or more data items electedfrom a group consisting of a user identifier of a client, a MAC addressof the user, an IP address of the user, a registration time of the user,and a login time of the user.
 26. The client of claim 18, wherein the Xmemory access modes, the Y verification algorithms, and the Z packagingformats are pre-stored in the memory of the client.
 27. The method ofclaim 8, further comprising: after sending the client verificationresult, receiving a code verification result from the server, the codeverification result being obtained by comparing the client verificationresult with a server verification result generated by the server basedon the selected verification sequence.
 28. The method of claim 8,further comprising: sending a user identifier of the client to theserver, wherein the verification sequence is randomly selected by theserver based on the user identifier.
 29. The method of claim 8, whereinthe verification sequence is randomly selected by the server based on arandom number, and the random number is generated from one or more dataitems elected from a group consisting of a user identifier of a client,a MAC address of the user, an IP address of the user, a registrationtime of the user, and a login time of the user.
 30. The method of claim8, wherein the X memory access modes, the Y verification algorithms, andthe Z packaging formats are pre-stored in the client.
 31. Anon-transitory computer-readable storage medium containing one or moreprograms, wherein the one or more programs include instructions that,when being executed by a processor, cause the processor to perform:receiving a verification sequence randomly selected from a plurality ofverification sequences from a server; determining a memory access modefrom X memory access modes, a verification algorithm from Y verificationalgorithms, and a packaging format from Z packaging formats based on thereceived verification sequence, wherein X, Y, and Z are integers largerthan 1; determining a verification address and a verification size for averification object based on the memory access mode of the selectedverification sequence, wherein the verification address overlaps with anaddress of the verification object; determining a memory access functionfrom a preset list of memory access functions based on the memory accessmode of the selected verification sequence; reading data for theverification object from memory based on the verification address, theverification size, and the memory access function; calculating a clientverification value using the data based on the verification algorithm ofthe selected verification sequence; packaging the client verificationvalue based on the packaging format of the selected verificationsequence to obtain a client verification result; and sending the clientverification result to the server.
 32. The storage medium of claim 31,wherein the packaging format comprises an order of a plurality of dataitems, wherein the plurality of data items comprise the verificationaddress, the verification size, the client verification result, thememory access mode, the verification algorithm, and the packagingformat.
 33. The storage medium of claim 32, wherein the plurality ofdata items comprise a superfluous data item.
 34. The storage medium ofclaim 31, wherein the instructions further cause the processor toperform: after sending the client verification result, receiving a codeverification result from the server, the code verification result beingobtained by comparing the client verification result with a serververification result generated by the server based on the selectedverification sequence.
 35. The storage medium of claim 31, wherein theverification sequence is randomly selected by the server based on arandom number, and the random number is generated from one or more dataitems elected from a group consisting of a user identifier of a client,a MAC address of the user, an IP address of the user, a registrationtime of the user, and a login time of the user.
 36. The storage mediumof claim 31, wherein the X memory access modes, the Y verificationalgorithms, and the Z packaging formats are pre-stored in the memory ofthe client.